<?php $this->headTitle('index');?>

<script type="text/javascript">

	$(document).ready(function(){

		// 隐藏Popup Panel
		var pop_up = false;
		$('#popup_panel').hide();
		
		// 初始化图片幻灯片效果
		$('#auction_slider').nivoSlider({
			effect: 'fold'
		});

		// 弹出，查看商品详情
		$('#product_detail').click(function() {
			if(pop_up == false) {
				$(".popup_panel").slideDown("slow");
				pop_up = true;
			} else {
				
			}
		});

		// 弹出，查看出价历史
		$('#bidding_history').click(function() {
			if(pop_up == false) {
				$(".popup_panel").slideDown("slow");
				pop_up = true;
			} else {

			}
		});

		// 关闭弹出框
		$('#close_popup').click(function() {
			$("#popup_panel").slideUp("slow");
			pop_up = false;
		});
		
		// 出价
		$('#auction_active').click(function() {
			
		});
		
		// 拍卖已结束
		$('#auction_end').click(function() {
			alert("拍卖已结束");
		});
   });
	   
</script>
			
<!-- banner begin-->
<div class="banner">
	<div class="menu">
		<ul>
			<li><a href="<?php echo $this->baseUrl();?>/index">正在竞拍<span>&nbsp;auctions</span></a></li>
			<li><a href="<?php echo $this->baseUrl();?>/winner">历史竞拍<span>&nbsp;winners</span></a></li>
			<li><a href="">金币充值<span>&nbsp;buy token</span></a></li>
			<li><a href="">竞拍手册<span>&nbsp;manual</span></a></li>
		</ul>
	</div>
</div>
<!-- banner end -->

<div class="dash_clear"> </div>

<!-- main begin -->
<div class="main">
	<?php echo $this->test; ?>
	<!-- main_auction begin -->
	<div class="main_auction">
		
		<div class="show_area">
			<div class="slider-wrapper theme-default">
	            <div class="ribbon"></div>
	            <div id="auction_slider" class="nivoSlider">
					<img src="<?php echo $this->auctions[0]['image1'] ?>" />
					<img src="<?php echo $this->auctions[0]['image2'] ?>" />
					<img src="<?php echo $this->auctions[0]['image3'] ?>" />
					<img src="<?php echo $this->auctions[0]['image4'] ?>" />
					<img src="<?php echo $this->auctions[0]['image5'] ?>" />
				</div>
			</div>
		</div>
		
		<div class="auction_panel">
			<table width="100%">
				<tr>
					<td colspan="2">
						<h3><?php echo $this->auctions[0]['name']; ?></h3>
					</td>
				</tr>
				<tr>
					<td colspan="2">
						<span>编号：<?php echo $this->auctions[0]['serial_no']; ?></span>
					</td>
				</tr>
				<tr>
					<td colspan="2">
						<div class="hrule"></div>
					</td>
				</tr>
				<tr>
					<td class="grey">最后出价</td>
					<td class="right">
						<img style="vertical-align: bottom;" width="20px" height="20px" src="<?php echo $this->auctions[0]['user_head']; ?>" />
						&nbsp;
						<a target="_blank" href="<?php echo $this->auctions[0]['user_home_page']; ?>">
							<?php echo $this->auctions[0]['user_name']; ?>
						</a>
					</td>
				</tr>
				<tr>
					<td class="grey">当前价</td>
					<td class="right"><h1>￥<?php echo $this->auctions[0]['current_price']; ?></h1></td>
				</tr>
				<tr>
					<td class="grey">参考价</td>
					<td class="right"><h2>￥<?php echo $this->auctions[0]['retail_price']; ?></h2></td>
				</tr>
				<tr>
					<td  class="grey">剩余时间</td>
					<td class="right"><h2><?php echo $this->auctions[0]['time_left']; ?></h2></td>
				</tr>
				<tr>
					<td colspan="2">
					<?php 
						if(0 == $this->auctions[0]['status']) {
							echo "<div id='auction_end' class='auction_end'>拍卖已结束</div>";
						} else if(1 == $this->auctions[0]['status']) {
							echo "<div id='auction_active' class='auction_active'>出&nbsp;&nbsp;&nbsp;价</div>";
						}
					?>
					</td>
				</tr>
				<tr>
					<td colspan="2"><a id="product_detail">商品详情</a>
					<a id="bidding_history">出价历史</a>
					<a id="bidding_history">尺码对照表</a></td>
				</tr>
			</table>
		</div>
	</div>
	<!-- main_auction end -->
	
	<div id="popup_panel" class="popup_panel">
		<div id="close_popup" class="close_popup">关闭</div>
		<p><b>产品详情：</b></p>
		<p><?php echo $this->auctions[0]['details']; ?></p>
		<p><b>品牌信息：</b></p>
		<p>
			<?php echo $this->auctions[0]['details']; ?> <br />
			<?php echo $this->auctions[0]['brand_name_cn']; ?> <br />
			<?php echo $this->auctions[0]['brand_name_en']; ?> <br />
			<?php echo $this->auctions[0]['brand_since']; ?> <br />
			<?php echo $this->auctions[0]['brand_country']; ?> <br />
			<?php echo $this->auctions[0]['brand_info']; ?> <br />
			<img src="<?php echo $this->auctions[0]['brand_logo']; ?>" /> <br />
			<?php echo $this->auctions[0]['category_name']; ?> <br />
		</p>
	</div>
	
	<!-- other_auction_frame end -->
	<div class="mid_content_frame">
		<div class="left_frame">
			<div class="left_block">
				最近中拍
				<?php foreach ($this->winners as $winner) :?>
					<p>
						<a href="index?auction_id=<?php echo $winner['auction_id']?>">
							<img width="100" height="100" src="<?php echo $winner['auction_image1'] ?>" />
						</a>
					</p>
					<p>
						<a target="_blank" href="<?php echo $winner['user_home_page'] ?>">
							<?php echo $winner['user_name'] ?>
						</a>
						￥<?php echo $winner['bid_price'] ?>
						成交时间<?php echo $winner['deal_time'] ?>
					</p>
				<?php endforeach;?>
			</div>
		</div>
		
		<div class="right_frame">
			<div class="advertise_panel">
				广告
			</div>
			
			<div class="other_auction_panel">
				<table>
					<?php 
						$count = 1;
						while($count < count($this->auctions)) {
							$auction = $this->auctions[$count];
							$count++;
					?>
					<tr>
						<td>
							<table>
								<tr><td colspan="2"><?php echo $auction['name']; ?></td></tr>
								<tr>
									<td>
										<a href="index?auction_id=<?php echo $auction['id']?>">
										<img width="150" height="150" src="<?php echo $auction['image1'] ?>" />
										</a>
									</td>
								</tr>
								<tr><td>剩余时间</td><td><?php echo $auction['time_left'] ?></td></tr>
								<tr>
									<td>当前价格</td>
									<td><?php echo $auction['current_price'] ?></td>
								</tr>
								<tr><td colspan="2"><a href="index?auction_id=<?php echo $auction['id']?>">进入竞拍</a></td></tr>
								<tr><td colspan="2"><input type="submit" value="出价" /></td></tr>
							</table>
						</td>
					</tr>
					<?php } ?>
				</table>
			</div>
		</div>
	</div>
	<!-- other_auction_frame end -->
	
</div>